package com.aruba.socketlibrary.entity;

/**
 * Created by aruba on 2017/10/23.
 * 文件传输准备对象
 */
public class SerialFileReq extends SerialFileBase {
    /**
     * 4bytes,文件大小
     */
    private long size;

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    @Override
    public boolean parseData(byte[] realData) {
        super.parseData(realData);

        long size = 0;
        for (int i = 0; i < 4; i++) {
            size += size * 256 + (realData[3 + i + getFileNameLength()] & 0xFF);
        }
        setSize(size);

        return true;
    }
}
